﻿#include "stdafx.h"
#include "qg/qguims.h"

//////////////////////////////////////////////////////////////////////////
// uim supp

//
const char* qgUimSupp::KeyToString(kbyte key)
{
	static const char* KeyNames[256] =
	{
		"NONE",
		"LBUTTON",
		"RBUTTON",
		"CANCEL",
		"MBUTTON",
		"XPBUTTON",
		"XNBUTTON",
		NULL,
		"BACK",
		"TAB",
		NULL,
		NULL,
		"CLEAR",
		"RETURN",
		NULL,
		NULL,
		"SHIFT",
		"CTRLOL",
		"ALT",
		"PAUSE",
		"CAPSLOCK",
		"INTL",
		NULL,
		"JUNJA",
		"FINAL",
		"INTLCONV",
		NULL,
		"ESCAPE",
		"CONVERT",
		"NONCONVERT",
		"ACCEPT",
		"MODECHANGE",
		"SPACE",
		"PGUP",
		"PGDN",
		"END",
		"HOME",
		"LEFT",
		"UP",
		"RIGHT",
		"DOWN",
		"SELECT",
		"PRINT",
		"EXECUTE",
		"SNAPSHOT",
		"INSERT",
		"DELETE",
		"HELP",
		"0",
		"1",
		"2",
		"3",
		"4",
		"5",
		"6",
		"7",
		"8",
		"9",
		NULL,		// :
		NULL,		// ;
		NULL,		// <
		NULL,		// =
		NULL,		// >
		NULL,		// ?
		NULL,		// @
		"A",
		"B",
		"C",
		"D",
		"E",
		"F",
		"G",
		"H",
		"I",
		"J",
		"K",
		"L",
		"M",
		"N",
		"O",
		"P",
		"Q",
		"R",
		"S",
		"T",
		"U",
		"V",
		"W",
		"X",
		"Y",
		"Z",
		"LWIN",
		"RWIN",
		"APPS",
		NULL,
		"SLEEP",
		"NUMPAD0",
		"NUMPAD1",
		"NUMPAD2",
		"NUMPAD3",
		"NUMPAD4",
		"NUMPAD5",
		"NUMPAD6",
		"NUMPAD7",
		"NUMPAD8",
		"NUMPAD9",
		"MULTIPLY",
		"ADD",
		"SEPARATOR",
		"SUBTRACT",
		"DECIMAL",
		"DIVIDE",
		"F1",
		"F2",
		"F3",
		"F4",
		"F5",
		"F6",
		"F7",
		"F8",
		"F9",
		"F10",
		"F11",
		"F12",
		"F13",
		"F14",
		"F15",
		"F16",
		"F17",
		"F18",
		"F19",
		"F20",
		"F21",
		"F22",
		"F23",
		"F24",
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		"NUMLOCK",
		"SCROLL",
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		"LSHIFT",
		"RSHIFT",
		"LCTRL",
		"RCTRL",
		"LALT",
		"RALT",
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		"PLUS",
		"COMMA",
		"MINUS",
		"PERIOD",
		"SLASH",
		"TILT",
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,		// D0
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,		// E0
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,		// F0
		NULL,
		NULL,
		NULL,
		NULL,
		NULL,
		"ATTN",
		"CRSEL",
		"EXSEL",
		"EREOF",
		"PLAY",
		"ZOOM",
		NULL,
		"PA1",
		"CLEAR"
	};

	return !KeyNames[key] ? KeyNames[0] : KeyNames[key];
}

//
const char* qgUimSupp::MouseButtonToString(kbyte button)
{
	static const char* ButtonNames[] =
	{
		"LEFT",
		"RIGHT",
		"MIDDLE",
		"PREV",
		"NEXT"
	};

	return button < K_COUNTOF(ButtonNames) ? ButtonNames[button] : "UNKNOWN";
}

//
const char* qgUimSupp::ControllerButtonToString(kushort button)
{
	static const char* ButtonNames[] =
	{
		"UP",
		"DOWN",
		"LEFT",
		"RIGHT",
		"START",
		"BACK",
		"THUMB LEFT",
		"THUMB RIGHT",
		"SHOULDER LEFT",
		"SHOULDER RIGHT",
		"A",
		"B",
		"X",
		"Y"
	};

	return button < K_COUNTOF(ButtonNames) ? ButtonNames[button] : "UNKNOWN";
}
